package com.lu.pojo.thread;

/**
 * @author luzhenfang
 * @date 2020 05 23
 * @description 静态代理模 模式
 */
interface Marry{
    /**
     *  人生四大喜
     *
     *  久旱逢甘霖
     *  他乡遇故知
     *  洞房花烛夜
     *  金榜题名时
     */
    void happyMarry();
}

class People implements Marry{

    @Override
    public void happyMarry() {
        System.out.println("洞房花烛夜~");
    }
}

class WeddingCompany implements Marry{
    private People people;

    public WeddingCompany(People people) {
        this.people = people;
    }

    public void before(){
        System.out.println("杀鸡宰牛 置办酒席");
    }

    public void after(){
        System.out.println("酬宾清会 送客扫场");
    }

    @Override
    public void happyMarry() {
        people.happyMarry();
    }
}
// 静态代理
public class StaticProxy {
    public static void main(String[] args) {
        WeddingCompany weddingCompany = new WeddingCompany(new People());
        weddingCompany.before();
        weddingCompany.happyMarry();
        weddingCompany.after();
    }
}
